package com.ruoyi.yljf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.ClockMapper;
import com.ruoyi.yljf.domain.Clock;
import com.ruoyi.yljf.service.IClockService;

/**
 * 打卡Service业务层处理
 * 
 * @author metaee
 * @date 2025-02-14
 */
@Service
@AllArgsConstructor
public class ClockServiceImpl extends ServiceImpl<ClockMapper, Clock> implements IClockService {

    private final ClockMapper clockMapper;
    
    /**
     * 查询打卡列表
     * 
     * @param clock 打卡
     * @return 打卡
     */
    @Override
    public List<Clock> selectClockList(Clock clock) {
    	LambdaQueryWrapper<Clock> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(clock.getUserId())) {
			queryWrapper.eq(Clock::getUserId, clock.getUserId());
		}
        if (StringUtils.isNotEmpty(clock.getContent())) {
			queryWrapper.eq(Clock::getContent, clock.getContent());
		}
        if (StringUtils.isNotEmpty(clock.getRecord())) {
			queryWrapper.eq(Clock::getRecord, clock.getRecord());
		}
        return clockMapper.selectList(queryWrapper);
    }
}
